//#define __FORCE_TRACE__
//#define __FORCE_DEBUG__
//#define __FORCE_INFO__
#define THIS_FILE "tools\fn_buildingPositions.sqf"
#include <tmf_constants.h>
#include <tmf_macros.h>

TRACE_1("Start",_this);
TMFPROFILERSTART;

private ["_center","_type","_radius","_bldgs","_positions","_bldarr","_i"];
DEFAULT_PARAM(_center,0,[]);
DEFAULT_PARAM(_type,1,[]);
DEFAULT_PARAM(_radius,2,60);

_positions = [];
_bldgs = _center nearObjects ["House", _radius];
If (count _bldgs > 0) then {
	for "_i" from 0 to (count _bldgs - 1) do {
		// We only take the first position of each building.
		_bldarr = [];
		// Using homebrewn building pos
		_bldarr = [(_bldgs select _i),_type,True, True] call FFUNC(buildingPosArray);
		DEBUG_1("Building Array",_bldarr);
		If (count _bldarr > 0) then {
			_positions = [_positions, _bldarr] call FFUNC(arrayPushStack);
		};
	};
};

TRACE_1("End",_positions);
TMFPROFILERSTOP;
_positions